import moment from 'moment';
import axios from "axios/index";

export function transDateTime(timeValue) {
  let timeStr = '';
  let seconds = moment.duration(timeValue).seconds();
  let minutes = moment.duration(timeValue).minutes();
  let hours = moment.duration(timeValue).hours();
  let days = moment.duration(timeValue).days();
  let months = moment.duration(timeValue).months();
  let years = moment.duration(timeValue).years();
  if (years) timeStr += `${years}年`;
  if (months) timeStr += `${months}月`;
  if (days) timeStr += `${days}日`;
  if (hours) timeStr += `${hours}时`;
  if (minutes) timeStr += `${minutes}分`;
  if (seconds) timeStr += `${seconds}秒`;
  return timeStr;
}

export function isMoblie() {
  let userAgentInfo = navigator.userAgent;
  return (userAgentInfo.indexOf('Windows') < 0);
}
export function newVideo (data) {
  return axios({
    method: 'post',
    url: 'plcPointRoutes',
    data: data
  })
}


